const config = {
  api: 'fileRecord',
  tables: [
    { prop: 'name', label: '附件名称' },
    { prop: 'fileServerCode',
      label: '附件服务器',
      formatter: function(row) {
        let fileServerList = sessionStorage.fileServerList
        if (fileServerList) {
          let parse = JSON.parse(fileServerList)
          let filter = parse.filter(e => {
            return e.value === row.fileServerCode
          })
          if (filter) {
            return filter[0].label
          }
        }
      } },
    { prop: 'fileTypeCode',
      label: '附件类别',
      formatter: function(row) {
        let fileTypeList = sessionStorage.fileTypeList
        if (fileTypeList) {
          let parse = JSON.parse(fileTypeList)
          let filter = parse.filter(e => {
            return e.value === row.fileTypeCode
          })
          if (filter) {
            return filter[0].label
          }
        }
      } },
    { prop: 'type', label: '附件格式' },
    { prop: 'nickName', label: '上传人' },
    { prop: 'status', label: '状态' }

  ],
  searchView: [
    {
      type: 'text',
      model: 'name',
      label: '附件名称'
    },
    {
      type: 'select',
      model: 'fileTypeCode',
      label: '附件类别',
      select: []
    },
    {
      type: 'select',
      model: 'fileServerCode',
      label: '附件服务器',
      select: []
    }
  ],
  formView: [

    {
      type: 'select',
      model: 'fileTypeCode',
      label: '文件类别',
      select: [
      ],
      rule: {
        message: '请选择文件类别'
      }
    },
    {
      type: 'upload_1',
      model: 'file',
      label: '附件',
      initValue: []
    }
  ]
}
export const api = config.api
export const formView = config.formView
export const tables = config.tables
export const searchView = config.searchView
export const initSelect = function() {
  let fileTypeCode = sessionStorage.fileTypeList
  if (fileTypeCode) {
    this.formView[0].select = JSON.parse(fileTypeCode)
  }
}
